package com.example.schedulecard.Databases;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class CourseDatabase extends SQLiteOpenHelper {
    public CourseDatabase(@Nullable Context context) {
        super(context, "schedule_card.db", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
//        创建课程存储数据表，course_name:课程名；teacher:上课教师；class_room:上课教室；day:星期几的课程
//        class_start:课程开始的节数；class_end:课程结束的节数；schedule_name:所属课程表；color:显示颜色
        String sql = "create table course(" +
                "id integer primary key autoincrement," +
                "course_name varchar(30) not null," +
                "teacher varchar(20) not null," +
                "class_room varchar(20) not null," +
                "day integer not null," +
                "class_start integer not null," +
                "class_end integer not null," +
                "schedule_name varchar(30) not null," +
                "color integer not null)";
        sqLiteDatabase.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
